Build_Transformation_Gateway:

 ld c, 1  ;Transformation Gateway ID
 jr AddObjectToGameBegin

Build_Refinery:

 ld c, 5 
 jr AddObjectToGameBegin

Build_Point_Defense:

 ld c, 2  
 jr AddObjectToGameBegin

Build_ACC:

 ld c, 15
 jr AddObjectToGameBegin

Build_AA_Tower:

 ld c, 3  
 jr AddObjectToGameBegin

Build_Detector:

 ld c, 6 
 jr AddObjectToGameBegin

Build_Watchtower:

 ld c, 7 
 jr AddObjectToGameBegin

Build_Universal_Defense:

 ld c, 4 
 jr AddObjectToGameBegin

Build_Argo_Laboratory:

 ld c, 8  
 jr AddObjectToGameBegin

Build_Factory:

 ld c, 9  
 jr AddObjectToGameBegin

Build_Starbase:

 ld c, 10  
 jr AddObjectToGameBegin

Build_Armory:

 ld c, 11  
 jr AddObjectToGameBegin

Build_Manhatton_Center:

 ld c, 13 
 jr AddObjectToGameBegin

Build_Command_Center:

 ld c, 12 
 jr AddObjectToGameBegin

Build_Operation_Center:

 ld c, 0
 jr AddObjectToGameBegin

Build_Quantum_Facility:

 ld c, 14  
 jr AddObjectToGameBegin





Goto_Build_Research_Buildings:

 ld e, ResearchBuildings
 ret

Goto_Build_Basic_Buildings:

 ld e, BasicBuildings
 ret

AddObjectToGameBegin:

 call AddObjectToGame
 
 jp Do_Menu_Operation_Return 




Draw_Item_Description: 

 push hl	;HL now points to the beginning of the menu

 ld de, 19	;Adding 19 to HL will place HL at the text data, meaning the
		;text that will be displayed depending on the menu item selected
 add hl, de


 call Get_X_Y_Icon_Menus ;Locate in the data the text needed to display

 add a, a	;Since each label for text is two bytes, we double the value in Register
		;A to skip two bytes for each button the text pertains to

 ld d, 0
 ld e, a
 add hl, de	;HL now pertains to the location of the text we want to display.
		
 
 ld e, (hl)
 inc hl
 ld d, (hl)
 ex de, hl	;HL no longer contains the location of the text.  It is now actually
		;pointed at the text.

 ld b,0
 ld c, (hl)	;The length of the first line of text.
 
 push bc	;We save this value because we need it later to determine if a 
		;second line of text needs to be displayed.


 inc hl		;HL goes past the length of the first line of next, and is now reading
		;the text itself.
 
 push hl	
 xor a
 ld (penCol),a	;The text will be displayed at the top of the screen.
 ld (penRow),a

 ld de, OP1
 ldir

 ld hl, OP1
 B_CALL _VPutS


 ld hl, 6*256+0
 ld (penCol), hl
 pop hl
 pop bc


 add hl, bc	;Now hl points to the length of the second line of text, if there is
		;such a line.

 ld b,0
 ld c, (hl)
 ld a, c
 or a		;If bc = 0, there is no second line of text to display.

 jr z, End_Draw_Item_Description

 inc hl		;HL points to the second line of text.
 ld de, OP1
 
 ldir
 ld hl, OP1
 B_CALL _VPutS

End_Draw_Item_Description:

 pop hl	;HL is popped so that the sub can return to where it needs to.
  
 ret 

Get_X_Y_Icon_Menus: ;Correctly locate where the text is.  It's located in the menu data,
			; so this sub will find the text.
 ld a, (TagX)

;Divide Register A by 16

 rra
 rra
 rra
 rra

 ld e,a ; Saves the value

 ld a, (TagY)
 sub 17
 

 rra
 rra
 rra
 rra
 
 ld d,a
 
 add a, d
 add a, d
 add a, e


 
 ret